<template>
    <div>
      <h1>方法</h1>
      <button :class="{active:item.id===kk}" v-for="item in anjian" :key="item.id" @click="selectAction(item.id)">{{item.title}}</button>
    </div>
</template>

<script>
export default {
    props:{
        kk:String
    },
    data(){
        return{
            anjian:[
                {title:"所有",id:"all"},
                {title:"已完成",id:"finished"},
                {title:"所有",id:"todo"},
            ]
        }
    },
    methods: {
        selectAction(id){
        this.$emit("select",id)
    }
    },
}
</script>

<style>
.active{
    background: red;
}
</style>